package CI.aufgabe2.cip.mynodes;

import CI.aufgabe2.cip.SymbolTable;
import CI.aufgabe2.cip.base.AbstractDescr;

public class MyFactorNode extends MyAbstractNode {

	private static final long serialVersionUID = 1L;
	private final MyIdNode ident;
	private final MyAbstractNode sel;
	private final MyIntNode integer;
	private final MyStrNode str;
	private final MyReadNode read;
	private final MyAbstractNode expr;

	public MyFactorNode(MyIdNode id, MyAbstractNode se) {
		ident = id;
		sel = se;
		integer = null;
		this.str = null;
		read = null;
		expr = null;
	}

	public MyFactorNode(MyIntNode in) {
		ident = null;
		sel = null;
		integer = in;
		this.str = null;
		read = null;
		expr = null;
	}

	public MyFactorNode(MyStrNode str) {
		ident = null;
		sel = null;
		integer = null;
		this.str = str;
		read = null;
		expr = null;
	}

	public MyFactorNode(MyReadNode re) {
		ident = null;
		sel = null;
		integer = null;
		this.str = null;
		read = re;
		expr = null;
	}

	public MyFactorNode(MyAbstractNode ex) {
		ident = null;
		sel = null;
		integer = null;
		this.str = null;
		read = null;
		expr = ex;
	}

	@Override
	public void print() {
		trace("FactorNode ");
		if (ident != null)
			ident.print();
		if (sel != null)
			sel.print();
		if (integer != null)
			integer.print();
		if (str != null)
			str.print();
		if (read != null)
			read.print();
		if (expr != null)
			expr.print();
		unindent();
	}
	
	
	public AbstractDescr compile(SymbolTable sym) {
		try {
			throw new  IllegalAccessException(this.getClass().getName());
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
